package initial

import (
	"flag"
	"server/src/global"
)

func InitFlag() {
	envir := flag.String("e", "dev", "dev:开发环境，uat:测试环境，prod:正式环境")
	flag.Parse()
	//环境变量
	flagEnvironment(*envir)
}

// 选择环境
func flagEnvironment(envir string) {
	switch envir {
	case "dev":
		global.ENVIRONMENT = global.DEV
	case "uat":
		global.ENVIRONMENT = global.UAT
	case "prod":
		global.ENVIRONMENT = global.PROD
	default:
		panic(any("请选择正确的环境，dev:开发环境，uat:测试环境，prod:正式环境"))
	}
}
